package com.sdgakj.repository;

import com.sdgakj.entity.Message;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface MessageDao extends PagingAndSortingRepository<Message, Long>, JpaSpecificationExecutor<Message> {
    
    @Query("from Message s where s.deltag = ?1 ")
    List<Message> findByTag(String tag);

    @Query("select max(id) from Message s where s.userId=?1 and s.mode = ?2 ")
    Long getMessageByCustomer(Long id, String code);

}
